package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class MoveFileByUsingStandardCopyOption {
	public static void main(String[] args) {
		Path moveFrom = FileSystems.getDefault().getPath("E:\\Copy\\2\\1.txt");
		Path moveTo = FileSystems.getDefault().getPath("E:\\Copy\\1\\1.txt");

		try {
			Files.move(moveFrom, moveTo, StandardCopyOption.COPY_ATTRIBUTES);
			System.out.println("文件从 " + moveFrom + " 移动到 " + moveTo + " 成功。");
		} catch (IOException e) {
			System.err.println(e);
		}

	}
}
